package main

import (
    "database/sql"
    "fmt"
    _ "github.com/go-sql-driver/mysql"
)

func main() {
    db, err := sql.Open("mysql", "root:Kou123$%^@tcp(39.107.87.114:3306)/book_manager?charset=utf8")
    if err!=nil {
        fmt.Println(err)
        return
    }

	type info struct {
		id int `db:"id"`
		name string `db:"name"`
		author string `db:"author"`
	}
	rows,err:=db.Query("SELECT * FROM book")

	for rows.Next(){
		var s info
		err=rows.Scan(&s.id,&s.name,&s.author,)
		fmt.Println(s)
	}
	rows.Close()
}
